<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--jstl을 쓰기 위해 사용 --%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%--숫자 포맷을 사용하기 위해 사용 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%><%--함수들을 이용하기 위해 사용 --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<!--<script type="text/javascript" src="script/sms_riskI_script.js"></script>-->
<%--팝업으로 띄웠을 경우 --%>
<c:if test="${param.flagPop=='Y'}">
<script type="text/javascript" src="script/sms_riskI_script.js"></script>
<script type="text/javascript" src="script/sms_util_script.js"></script>
<link href="reset.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<!--말 줄임 css(모든 브라우저 적용)-->
<style type="text/css">
.ellipsis{
	white-space:nowrap;
	text-overflow:ellipsis;		/* IE, Safari */
	-o-text-overflow:ellipsis;		/* Opera under 10.7 */
	overflow:hidden;			/* "overflow" value must be different from "visible" */ 
	-moz-binding: url('ellipsis.xml#ellipsis');
}
</style>


<script type="text/javascript">
function winClose(){
	window.close();
}
</script>
</c:if>

</head>
<body onload="onloadLowDoA('${requestScope.tdoa[0].riskb_score }','${requestScope.tdoa[1].riskb_score }','${requestScope.tdoa[0].v_score }','${requestScope.tdoa[1].v_score }','${requestScope.tdoa[0].sy_score }','${requestScope.tdoa[1].sy_score }')">
<c:if test="${sessionScope.USER_ID==null && param.flagPop=='Y'}">

		<script type="text/javascript">
			alert("연결이 끊어졌습니다. 다시 로그인 해주시기 바랍니다");
			window.close();
		</script>	
</c:if>

<%-- 팝업 페이지만 있기 때문에 위험수준기준 페이지 수정을 위해서는 mvscore페이지도 같이 수정바람. --%>
<div class="box">
      		<h4 class="white">
      			<span class="align-left">DOA설정</span>
	      		<span class="align-right">마감상태(RTP수립) :
		      		<c:choose>
		      			<c:when test="${sessionScope.magamSession[5].state =='Y'}">
		      				 마감
		      			</c:when>
		      			<c:otherwise>
		      				 착수
		      			</c:otherwise>
		      		</c:choose>
	      		</span>
      		</h4>
    <div class="box-container1">     	
         <form action="riskIAction.do" method="post" name="DoA" id="DoA">
         	<input type="hidden" name="flagPop" id="flagPop" value="${param.flagPop }"></input>
         	<input type="hidden" name="reloadPageName" id="reloadPageName" value="${param.reloadPageName }"></input>
			 <input type="hidden" name="mode" value="DoA_insert"></input>
			 <input type="hidden" name="pro_id" id="pro_id" value="${sessionScope.lastProId }"></input>
			 
			 <input type="hidden" name="lowDoA_score" id="lowDoA_score" value="${requestScope.tdoa[0].doa_score }"></input>
			 <input type="hidden" name="highDoA_score" id="highDoA_score" value="${requestScope.tdoa[1].doa_score }"></input>
			 
			 <input type="hidden" name="saveLowDoA" id="saveLowDoA" value="r${requestScope.tdoa[0].riskb_score }v${requestScope.tdoa[0].v_score }a${requestScope.tdoa[0].sy_score }"></input>
			 <input type="hidden" name="saveHighDoA" id="saveHighDoA" value="r${requestScope.tdoa[1].riskb_score }v${requestScope.tdoa[1].v_score }a${requestScope.tdoa[1].sy_score }"></input>
			 <input type="hidden" name="saveTimesLowDoA" id="saveTimesLowDoA" value="times_r${requestScope.tdoa[0].riskb_score }v${requestScope.tdoa[0].v_score }a${requestScope.tdoa[0].sy_score }"></input>
			 <input type="hidden" name="saveTimesHighDoA" id="saveTimesHighDoA" value="times_r${requestScope.tdoa[1].riskb_score }v${requestScope.tdoa[1].v_score }a${requestScope.tdoa[1].sy_score }"></input>
			 
			 <input type="hidden" name="saveBackupData" id="saveBackupData"></input>
			 
        	<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<tfoot>
      				<tr>
      					<td>
      					<div class="align-left subjectTitle"> ■DoA 설정</div>
      					<%--DoA 추가로 인하여 수정 페이지 접근 불가 
      					<a href="#" class="button" onclick="javascript: riskIWritePage('mrlevel_insertPage')"><span>수정</span></a>
      					--%>
      					<div class="align-right"><!--select class="form-select"><option value="option1">Bulk Options</option>
      					<option value="option2">Delete All</option></select-->
      						<c:choose>
	                       		<c:when test="${sessionScope.magamSession[5].state !='Y'}">
	                       		<!-- 마감 현황이 유무 판별(Y 시 입력 불가) -->
	                       			<a href="#" class="button lastButton" onclick="javascript: riskIWrite('DoA_insert')"><span>저장</span></a>
	                       		</c:when>
	                       		<c:otherwise>
	                       			<a href="#" class="button1 lastButton"><span>저장</span></a>
	                       		</c:otherwise>
	                       	</c:choose>
	                       	</div>
                        </td>
      				</tr>
      				<tr><td class="spaceLine"></td></tr>
      			</tfoot>
      		</table>
      		<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<thead>
	      			<tr>
	      				<td colspan="2" class="col-rowspanMid" style="text-align: center; padding: 0" height="30px"><div class="yellow">DoA기준</div></td>
	      				<td colspan="2" class="col-alignCenter col-rowspanMid"><div class="align-left yellow">=</div><div class="yellow">위험발생 가능성</div></td>
	      				<td colspan="2" class="col-alignCenter col-rowspanMid"><div class="align-left yellow">&times;</div><div class="yellow">취약성 등급</div></td>
	      				<td colspan="2" class="col-alignCenter col-rowspanMid"><div class="align-left yellow">&times;</div><div class="yellow">사업영향도</div></td>
	      			</tr>
	      			
	      			
	      			<%--LowDoA  시작--%>
	      			<tr>
	      				<td style="text-align: center; padding: 0">DoA</td>
	      				<td class="noBGC col-alignCenter col-first">
		      				<div class="red" id="lowDoA">
		      					<fmt:formatNumber value="${requestScope.tdoa[0].doa_score}" pattern="0"/>
		      					(<fmt:formatNumber value="${requestScope.tdoa[0].doa_score*1.67 }" pattern="0"/>)
		      				</div>
	      				</td>
	      				<td class="col-alignCenter">위험발생 가능성</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="riskb_score_L" id="riskb_score_L" class="selectBox" style="width: 96%" onchange="javascript: calLowDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									 <option <c:if test="${rbList.base_cnt == requestScope.tdoa[0].riskb_score }">selected</c:if> value="<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      				<td class="col-alignCenter">취약성 등급</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="v_score_L" id="v_score_L" class="selectBox" style="width: 96%" onchange="javascript: calLowDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									 <option <c:if test="${vlList.base_cnt == requestScope.tdoa[0].v_score }">selected</c:if> value="<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      				<td class="col-alignCenter">사업영향도</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="sy_score_L" id="sy_score_L" class="selectBox" style="width: 96%" onchange="javascript: calLowDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="akList" items="${requestScope.akList}" varStatus="status">
									 <option <c:if test="${akList.base_cnt == requestScope.tdoa[0].sy_score }">selected</c:if> value="<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      			</tr>
	      			<%--LowDoA 끝 --%>
	      			
	      			<%--HighDoA 시작 --%>
	      			<tr>
	      				<td style="text-align: center; padding: 0">A등급 위험기준</td>
	      				<td class="noBGC col-alignCenter col-first">
		      				<div class="blue" id="highDoA">
		      					<fmt:formatNumber value="${requestScope.tdoa[1].doa_score }" pattern="0"/>
		      					(<fmt:formatNumber value="${requestScope.tdoa[1].doa_score*1.67 }" pattern="0"/>)
		      				</div>
	      				</td>
	      				<td class="col-alignCenter">위험발생 가능성</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="riskb_score_H" id="riskb_score_H" class="selectBox" style="width: 96%" onchange="javascript: calHighDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									 <option <c:if test="${rbList.base_cnt == requestScope.tdoa[1].riskb_score }">selected</c:if> value="<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      				<td class="col-alignCenter">취약성 등급</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="v_score_H" id="v_score_H" class="selectBox" style="width: 96%" onchange="javascript: calHighDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									 <option <c:if test="${vlList.base_cnt == requestScope.tdoa[1].v_score }">selected</c:if> value="<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      				<td class="col-alignCenter">사업영향도</td>
	      				<td class="noBGC col-alignCenter">
	      					<select name="sy_score_H" id="sy_score_H" class="selectBox" style="width: 96%" onchange="javascript: calHighDoA(this)" onclick="javascript: sbData(this);">
		      					<c:forEach var="akList" items="${requestScope.akList}" varStatus="status">
									 <option <c:if test="${akList.base_cnt == requestScope.tdoa[1].sy_score }">selected</c:if> value="<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt }" pattern="0"/></option>
								</c:forEach>
							</select>
	      				</td>
	      			</tr>
	      			<%--HighDoA 끝 --%>
      			</thead>
      			<tbody>
      				<tr><td class="spaceLine" colspan="8"></td></tr>
      			</tbody>
      		</table>
      		<br/>
      		<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<tfoot>
      				<tr>
      					<td>
      						<div class="align-left subjectTitle">● ${requestScope.riskdegree }점 척도</div>
                        </td>
      				</tr>
      				<tr><td class="spaceLine"></td></tr>
      			</tfoot>
      		</table>
      		<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<colgroup>
					<col width="60px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
				</colgroup>
      			<thead>
      				<tr>
						<td colspan="3"  style="padding-left: 10px" height="25px">위험발생가능성</td>
						<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
							<td colspan="4" class="col-alignCenter">${rbList.base_lev2 }(<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>)</td>
						</c:forEach>
					</tr>
					<tr>
						<td  colspan="3"  style="padding-left: 10px" height="25px">취약성 등급</td>
						<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
							<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
								<td class="col-alignRight"><fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/></td>
							</c:forEach>
						</c:forEach>
					</tr>
      			</thead>
      			<tbody>
				<c:forEach var="akList" items="${requestScope.akList}" varStatus="status">
					<c:choose>
						<c:when test="${akList.base_lev1=='01'}">
							<tr class="odd">
								<td rowspan="3" class="col-rowspanMid"  style="padding-left: 10px">사업 영향도</td>
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:when>
						<c:when test="${akList.base_lev1=='02'}">
							<tr>
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:when>
						<c:otherwise>
							<tr class="odd">
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:otherwise>
					</c:choose>
				</c:forEach>
				</tbody>
      		</table> 
      		<br/>
      		<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<tfoot>
      				<tr>
      					<td>
      						<div class="align-left subjectTitle">● ${requestScope.exChangeRD }점 척도</div>
      					</td>
      				</tr>
      				<tr><td class="spaceLine"></td></tr>
      			</tfoot>
      		</table> 
      		<table class="table-long" <c:if test="${param.flagPop=='Y'}">style="margin: 0 auto;"</c:if>>
      			<colgroup>
					<col width="60px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<!--  -->
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
					<col width="20px"/>
				</colgroup>
      			<thead>
      				<tr>
						<td colspan="3" style="padding-left: 10px" height="25px">위험발생가능성</td>
						<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
							<td colspan="4" class="col-alignCenter">${rbList.base_lev2 }(<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>)</td>
						</c:forEach>
					</tr>
					<tr>
						<td  colspan="3" style="padding-left: 10px" height="25px">취약성 등급</td>
						<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
							<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
								<td class="col-alignRight"><fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/></td>
							</c:forEach>
						</c:forEach>
					</tr>
      			</thead>
      			<tbody>
				<c:forEach var="akList" items="${requestScope.akList}" varStatus="status">
					<c:choose>
						<c:when test="${akList.base_lev1=='01'}">
							<tr class="odd">
								<td rowspan="3" class="col-rowspanMid" style="padding-left: 10px">사업 영향도</td>
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="times_r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt*1.67 }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:when>
						<c:when test="${akList.base_lev1=='02'}">
							<tr>
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="times_r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt*1.67 }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:when>
						<c:otherwise>
							<tr class="odd">
								<td height="25px">${akList.base_lev2 }</td>
								<td>(<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>)</td>
								<c:forEach var="rbList" items="${requestScope.rbList}" varStatus="status">
									<c:forEach var="vlList" items="${requestScope.vlList}" varStatus="status">
									<td class="col-alignRight" id="times_r<fmt:formatNumber value="${rbList.base_cnt }" pattern="0"/>v<fmt:formatNumber value="${vlList.base_cnt }" pattern="0"/>a<fmt:formatNumber value="${akList.base_cnt }" pattern="0"/>"><fmt:formatNumber value="${akList.base_cnt*vlList.base_cnt*rbList.base_cnt*1.67 }" pattern="0"/></td>
									</c:forEach>
								</c:forEach>
							</tr>
						</c:otherwise>
					</c:choose>
				</c:forEach>
				</tbody>
      		</table> 	
   		</form>	
   	</div><!-- end of div.box-container1 -->
</div> <!-- end of div.box -->
</body>
</html>